<h1>ExceptionHandler</h1>

<p>An ExceptionHandler action is used to specify try..catch blocks so exceptions can be thrown 
and handled when executing a series of actions.
</p>
<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top"><a name="ActionType">Type</a></td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>Identifies the action when it is encoded.</td>
</tr>

<tr>
<td nowrap valign="top"><a name="ActionLength">Length</a></td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The number of bytes in the rest of the encoded action. The total number of
bytes in the encoded action is Length+3.</td>
</tr>

<tr>
<td nowrap valign="top">reserved</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">5</td>
<td>Reserved</td>
</tr>

<tr>
<td nowrap valign="top">hasVariable</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Place the caught object in either a register (false) or a named variable (true).</td>
</tr>

<tr>
<td nowrap valign="top">hasCatch</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Does the instruction contains actions for a catch block.</td>
</tr>

<tr>
<td nowrap valign="top">hasFinal</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Does the instruction contains actions for a final block.</td>
</tr>

<tr>
<td nowrap valign="top">tryLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The number of bytes that the encoded actions in the try block occupy.</td>
</tr>

<tr>
<td nowrap valign="top">catchLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The number of bytes that the encoded actions in the catch block occupy.</td>
</tr>

<tr>
<td nowrap valign="top">finalLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The number of bytes that the encoded actions in the final block occupy.</td>
</tr>

<tr>
<td nowrap valign="top">variable</td>
<td nowrap valign="top">String</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The variable in memory that the thrown object will be assigned to. Optional, 
Omitted if the register attribute is set.</td>
</tr>

<tr>
<td nowrap valign="top">register</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>The register number where the thrown object will be placed.</td>
</tr>

<tr>
<td nowrap valign="top">tryActions</td>
<td nowrap valign="top">Action[n]</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The actions executed in the try block of the exception.</td>
</tr>

<tr>
<td nowrap valign="top"><a name="FSExceptionHandler_4">catchActions </a></td>
<td nowrap valign="top">Action[n]</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The actions executed in the catch block of the exception. Defining actions 
for the catch block is optional and may be set to the null object or an empty 
array if no actions will be executed.</td>
</tr>

<tr>
<td nowrap valign="top">finalActions</td>
<td nowrap valign="top">Action[n]</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The actions executed in a finally block of the exception. Defining actions 
for the finally block is optional and may be set to the null object or an empty 
array if no actions will be executed.</td>
</tr>

</table>

<p>The thrown object can be assigned to either one of the Flash Player's 256 
internal registers or to a variable in memory. If a register number is set the 
variable name is set to null. Similarly if a variable name is set then the 
register number is set to zero.</p>

<p>An ExceptionHandler contains three arrays of actions supporting the standard 
syntax for an exception with try, catch and finally blocks. An exception is 
thrown by a Throw action which pops a value off the stack and assigns it to 
either a named variable or one of the Flash Player's internal registered so it 
can be processed by the actions in the catch block.</p>

<p>Exceptions may be nest to any level if a thrown exception is not handled by 
the immediate catch block it is propagated to the next handler in the exception 
hierarchy and so on until it is caught.</p>

<p>Both the catch and finally blocks are optional when defining an exception, 
the corresponding arguments in constructors and accessor methods may be set to 
null.</p>

<h2>History</h2>

<p>ExceptionHandler represents the Try action introduced in Flash 7 and is used 
to directly support the exception handling syntax defined in ActionScript 2.0.</p>
